using System;
using System.ComponentModel.DataAnnotations;
using Yitter.IdGenerator;
using SqlSugar;

namespace MultipleDB.Entitys
{
    /// <summary>
    /// Web Api 请求记录
    /// </summary>
    /// 
    [Tenant("2")]//对应ConfigId
    public class ApiRequestLog
    {
        /// <summary>
        /// Id
        /// </summary>
        [Newtonsoft.Json.JsonConverter(typeof(ValueToStringConverter))] //JsonConverter的命名空间
        [SugarColumn(IsPrimaryKey = true)]
        public long Id { get; set; } = YitIdHelper.NextId();

        /// <summary>
        /// 控制器
        /// </summary>
        public string Controller { get; set; }

        /// <summary>
        /// 方法
        /// </summary>
        public string Action { get; set; }

        /// <summary>
        /// 路由
        /// </summary>
        public string Route { get; set; }

        /// <summary>
        /// 请求方式
        /// </summary>
        public string Method { get; set; }

        /// <summary>
        /// 请求账号
        /// </summary>
        public string? SysUser_Account { get; set; } = "";

        /// <summary>
        /// 客户端请求IP
        /// </summary>
        public string? IpAddress { get; set; }

        /// <summary>
        /// 请求内容
        /// </summary>
        public string? RequestContent { get; set; }

        /// <summary>
        /// 操作状态（0操作失败 默认=1操作成功）
        /// </summary>
        public bool Status { get; set; } = true;

        /// <summary>
        /// 输出内容
        /// </summary>
        public string? ResponseContent { get; set; }
        /// <summary>
        /// UserAgent
        /// </summary>
        public string? UserAgent { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public System.DateTime CreateTime { get; set; } = DateTime.Now;
    }
}